<html> <head> <title>Simple Frame Page</title> </head> <frameset cols="30%, *" frameborder="no"> <frame src="left_side.html" name="left" scrolling="auto" marginwidth="20" noresize> <frame src="right_side.html" name="right"> </frameset> <noframes> <!-- Some browsers do not support frames. --> <!-- Please put source for these browsers to view here. --> </noframes>Now, this page would create a page with two frames on it. Understanding what the frame and frameset tags do is not needed. Nor is it important that you even know how this page would be layed out. In fact, if you're using framework to design your html pages, there are only 3 things on this page that you should understand. The first is that every frame has a src (or source) attribute. This attribute tells your web browser where to find the html document that belongs in that specific frame. In this case, we have two source files, left_side.html and right_side.html. The source can also be a full url, for example "http://www.somepage.com/". When you are setting up your html pages in framework, it's important that you define a source for every frame that you create.
The second feature that's important on this page is the fact that every frame should have a name attribute if you plan to have links on your page which load into that frame. Names should be distinct. I also like to choose names that are reprentative of the frame. In this case, I chose "left" and "right" because one frame is on the left and one is on the right. I'll come back to why naming each of your frames is nessasary later in this document.
The last feature that you should be familar with on this page is the "noframes" option. This section is provided so that you can give browsers that don't support frames an alternate html page
Element | Option | Dexcription | |
Scrolling | Yes | Gives the frame scroll bars regaurdless of the data inside the frame | |
No | The frame will never have scroll bars. | ||
Auto | The browser decides if this frame will have scroll bars based upon the data inside of the frame and the size of the frame. | ||
Resize | resize | This frame can be resized by the user | |
noresize | This frame can't be resized by the user | ||
Src | string | This is the url to the html file that belongs inside the frame | |
Name | string | The name attribute isn't required, but is needed if you plan to have any links that you want to target to this frame. | |
Marginwidth | integer | The marginwidth is used to determine the minimum number of pixels from the right and left sides of the frame that that text can go to. It's useful if you have some text that you would like to be away from the sides of the frame | |
Marginheight | integer | The marginheight is used to determine the minimum number of pixels from the top and bottom of the frame that that text can go to. It's useful if you have some text that you would like to be away from the top and bottom of the frame |
<html><head></head><body bgcolor="white"><a href="http://www.yahoo.com">Yahoo</a><br><a href="http://www.yahoo.com" target="right">Right minded Yahoo</a><br><a href="http://www.yahoo.com" target="_top">A Fresh look at Yahoo</a><br><a href="http://www.yahoo.com" target="_new">Yahoo to a new window</a><br><a href="http://www.yahoo.com" target="_self">Self-centered Yahoo</a><br></body></html>This frame just has a few links to Yahoo, but each link will behave differently because each one is targeted in a special manner. Since we gave the right frame the name "right", the second link will load into that frame. All the other links demonstrate the use of special targets. These targets can always be used for links and are defined as follows: